import Vue from 'vue'
import VueRouter from 'vue-router'
import FindMusic from '@/views/FindMusic/index'
import MyMusic from '@/views/MyMusic/index'
import Friend from '@/views/Friend/index'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'FindMusic',
    component: FindMusic,
    redirect: '/recommend',
    children: [
      {
        path: 'recommend',
        name: 'Recommend',
        component: () => import('@/views/Recommend/index')
      },
      {
        path: 'rank/:id?',
        name: 'RankingList',
        component: () => import('@/views/RankingList/index')
      },
      {
        path: 'singer',
        name: 'Singer',
        component: () => import('@/views/Singer/index'),
        children: [
          {
            path: '',
            name: 'Recommend',
            component: () => import('@/views/Singer/components/Recommend/index')
          },
          {
            path: 'signed',
            name: 'Signed',
            component: () => import('@/views/Singer/components/Ruzhu')
          },
          {
            path: 'cat/:id',
            name: 'Cat',
            component: () => import('@/views/Singer/components/Singers')
          }
        ]
      },
      {
        path: 'singerMus/:id',
        name: 'SingerMus',
        component: () => import('@/views/Singer/components/Singer_music')
      },
      {
        path: 'geren/:id',
        name: 'GeRen',
        component: () => import('@/views/Singer/components/GeRen')
      },
      {
        path: 'songlist',
        name: 'SongList',
        component: () => import('@/views/SongList/index')
      }

    ]
  },
  {
    path: '/details',
    name: 'Details',
    component: () => import('@/views/SongList/components/details.vue')
  },
  {
    path: '/my',
    name: 'MyMusic',
    component: MyMusic
  },

  {
    path: '/friend',
    name: 'Friend',
    component: Friend
  },

  {
    path: '/song/:id',
    name: 'Song',
    component: () => import('@/views/Song/index.vue')
  },

  {
    path: '/album/:id',
    name: '',
    component: () => import('@/views/AlbumDetail/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
